-- 下行代码只代表查值时自动查global,增加global的变量或者修改global的变量时还是需要带"GLOBAL."
GLOBAL.setmetatable(env, { __index = function(t, k) return GLOBAL.rawget(GLOBAL, k) end })
GLOBAL.SHADOWWOVEN = env
local _G = GLOBAL

-- ※标注的地方大概率在新增内容的时候需要添加对应的参数,请仔细核对※标注的部分

-- 获取mod配置,放到官方的全局变量tuning表中
TUNING.SHADOWWOVEN = {}
TUNING.SHADOWWOVEN.LANGUAGE = GetModConfigData("languages")     -- 获取配置:语言
TUNING.SHADOWWOVEN.TREE_GROWTH = GetModConfigData("TreeGrowth") -- 获取配置:光影树催长
TUNING.SHADOWWOVEN.SW_PIGBOT_WORK_RADIUS = 25

-- 设置语言
if TUNING.SHADOWWOVEN.LANGUAGE == "Chinese" then
    modimport("scripts/languages/sw_chinese.lua") -- ※中文
elseif TUNING.SHADOWWOVEN.LANGUAGE == "English" then
    modimport("scripts/languages/sw_english.lua") -- ※英文
else
    modimport("scripts/languages/sw_chinese.lua")
end

-- ※万物皆是prefab
PrefabFiles = {
    "sw_skins",                 -- 皮肤
    "sw_veggies",               -- 作物种子及对应产物
    "sw_preparedfoods",         -- 料理
    "sw_buffs",                 -- Buff
    "sw_fx",                    -- 特效
    "sw_magma_essence",         -- 岩浆精华液
    "sw_hats",                  -- 头戴装备
    "sw_shadow_crown_equipped", -- 暗影之冕装备特效
    "sw_shadow_fragment",       -- 暗影碎片
    "sw_shards",                -- 暗影/启迪碎屑
    "sw_pigweed_pouch",         -- 猪草弹药包
    "sw_shadowwoven_tower",     -- 光影交织塔
    "sw_glass_tree_sapling",    -- 琉璃树苗
    "sw_moonlight_glass_tree",  -- 月光琉璃树
    "sw_shadow_tree",           -- 恐惧树
    "sw_pigbot",                -- 猪器人
    "sw_deeper_shadowstone",    -- 更深暗影石
    "sw_pig_cannon",            -- 猪猪炮
    "sw_piggy_bomb",            -- 猪猪弹/启迪猪猪弹/暗影猪猪弹
    "sw_woven",                 -- 交织光影
    "sw_infernal_stone",        -- 镇狱石
}

Assets = {
    Asset("ATLAS", "images/sw_inventoryimages.xml"), -- 物品栏贴图集
    Asset("IMAGE", "images/sw_inventoryimages.tex"),
    Asset("ATLAS_BUILD", "images/sw_inventoryimages.xml", 256),

    Asset("ATLAS", "images/sw_crafting_menu_icons.xml"), -- 科技栏图标
    Asset("IMAGE", "images/sw_crafting_menu_icons.tex"),

    Asset("ATLAS", "minimap/sw_minimap.xml"), -- 小地图贴图集
    Asset("IMAGE", "minimap/sw_minimap.tex"),

    -- ※前往 sw_minisign_list.lua 添加参数
    Asset("ANIM", "anim/sw_minisign1.zip"),              -- 小木牌256高清贴图

    Asset("ANIM", "anim/farm_plant_sw_piggymimosa.zip"), -- 晗猪草动画包
    Asset("ANIM", "anim/sw_foods.zip"),                  -- 料理动画包
    Asset("ANIM", "anim/sw_chasing_light_shadow.zip"),   -- 追光逐影动画包
}

-- 注册贴图集
modimport("scripts/sw_tool.lua") -- 工具
SW_TOOL.Tool_RegisterInventoryItemAtlas("images/sw_inventoryimages.xml")

-- 注册小地图图标
AddMinimapAtlas("minimap/sw_minimap.xml")

-- 判断某些mod是否开启
modimport("scripts/sw_linkmod.lua")

-- 全局函数
modimport("scripts/sw_globalfn.lua")

-- 资源文件导入
modimport("scripts/sw_farm_plant_defs.lua") -- 本mod农作物
modimport("scripts/sw_tech.lua")            -- 本mod科技相关
modimport("scripts/sw_rpc.lua")             -- 本mod的rpc
modimport("scripts/sw_hook.lua")            -- 本mod钩子:在原版的代码中,加入自己的代码
modimport("scripts/sw_cooking.lua")         -- 烹饪相关
modimport("scripts/sw_actions.lua")         -- 动作
modimport("scripts/sw_recipe.lua")          -- ※制作配方
modimport("scripts/sw_skinapi.lua")         -- 风铃大佬的皮肤API
modimport("scripts/sw_skin_ownership.lua")  -- 皮肤拥有者(防君子不防小人哦)
modimport("scripts/sw_containers.lua")      -- 容器
modimport("scripts/sw_legion.lua")          -- 棱镜兼容相关
